import java.util.Random;
import java.util.Scanner;

public class B {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = a%b;
        while(c != 0){
            a = b;
            b = c;
            c = a%b;
        }
        System.out.println("最大公约数：" + b);
        /*while(true){
            int c = a%b;
            if(a % b == 0){
                System.out.println("最大公约数：" + b);
                break;
            }
            a = b;
            b = c;
        }*/
    }
    public static void main7(String[] args) {
        String a = "";
        String b = "";
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int i = 0; i < 32; i+=2) {
            a = ((n>>i)&1) + a;
        }
        for (int i = 1; i < 32; i+=2) {
            b = ((n>>i)&1) + b;
        }
        System.out.println("偶数位"+a);
        System.out.println("奇数位"+b);
    }
    public static void main6(String[] args) {
        String name = "123456";
        Scanner scanner = new Scanner(System.in);
        int count = 0;
        while(true) {
            System.out.print("请输入密码:>");
            String a = scanner.next();
            if(a.equals(name)){
                System.out.println("密码正确！");
            } else {
                if(count==2){
                    System.out.println("密码输入错误已达三次，退出程序！");
                    break;
                }else{
                    System.out.println("密码错误，重新输入！");
                    count++;
                }
            }
        }
    }
    public static void main5(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNext()){
            int a = scanner.nextInt();
            while(a!=0){
                System.out.print(a%10+" ");
                a /= 10;
            }
            System.out.println();
        }
    }
    public static void main4(String[] args) {
        Random random = new Random();
        Scanner scanner = new Scanner(System.in);
        int a = random.nextInt(100);//[0,100)
        while(true){
            int b = scanner.nextInt();
            if(a == b){
                System.out.println("猜对了！");
                break;
            } else if (a > b) {
                System.out.println("猜小了！");
            }else{
                System.out.println("猜大了！");
            }
        }
        scanner.close();
    }
    public static void main3(String[] args) {
        double sum = 0.0;
        int flag = 1;
        for (int i = 1; i <= 100; i++) {
            double tmp = 1.0 / i;
            sum += tmp*flag;
            flag = -flag;
        }
        System.out.println(sum);
    }
    public static void main2(String[] args) {
        int sum = 0;
        for (int i = 1; i <= 100; i++) {
            int tmp = i;
            while(tmp != 0){
                if(tmp%10 == 9){
                    sum++;
                }
                tmp /= 10;
            }
        }
        System.out.println(sum);
    }
    public static void main1(String[] args) {
        int i = 100;
        while (i<=200){
            if(i%3 == 0 && i%4 == 0) {
                System.out.println(i++);
                continue;
            }
            i++;
        }
    }
}
